var express = require('express');
var router = express.Router();
var superagent = require('superagent');// 使用了superagent来发起请求

var CONFIG = require('../../common/config');

//------------------------------------------------------------------

/* 获取主页数据.
 * 方式:GET
 * 参数:pc:1表示从pc来的请求/为空或者其它值表示从手机来的请求
 * 参数:docId:用户文档id
 * */
function createPPT(req, res, next) {
    var docId = req.query.docId || req.body.docId;
    var url = CONFIG.PPT_SERVER_DOMAIN +':'+CONFIG.PPT_SERVER_PORT+'/ppt/createPPT?docId='+docId;

    var sreq = superagent.get(url);
    sreq.pipe(res);
    sreq.on('end', function(){
        console.log('done');
    });


}

router.get('/createPPT', createPPT);
router.post('/createPPT', createPPT);




module.exports = router;
